Example:
Copy Code code as follows:
#!/bin/perl
Print "Please input a string and a number by order!\n";
$the _string=<>;
$the _numb=<>;
Print "The result is \ n";
Print "$the _string" x "$the _numb";
Results:The
Not yet a systematic study of Ruby, recently looking at the Metasploit framework of the exploit will involve the Ruby script, it would be very hard to check the data once again to make some notes.There are built-in functions for chop and chomp in
Chomp is used to remove line breaks.
Copy Code code as follows:
#!/usr/bin/perl
$c = "ABCDE";
Chomp ($c);
print "$c \ n";
[Root@ak]# Perl a.pl
Abcde
Chop is used to delete the last character.
Copy Code
1. Returns the length of the string
Copy Code code as follows:
Str.length => Integer
2. Determine if the string contains another string
Copy Code code as follows:
Str.include? Other_str => True or False
Open the file with the open () function
The common ways to open files are:
Copy Code code as follows:
Open (FH, "Or die "couldn ' t open $filename for reading: $!";
The open () function usually comes with two arguments, the
String
The two classes, String and Symbol, provide the ability to represent text and work with text. The two classes are very different.
String representation
A string is generally wrapped in a set of quotation marks:
"That's a string."Single
I. Data Types(Data type):
Perl has four data types: Scalar (variable), Scalar Array (Array), Hash Array (Hash), and References (pointer ), it seems to be rare, but it is more than enough to use it. Especially when writing Perl programs, you do not
I. Process processing functions
1. Process startup Function
Function Name eval
Call the syntax eval (string)
Describe the stringPerlStatement execution.
After the command is correctly executed, the system variable $ @ is an empty string. If an error
Before studying the basics of Perl, we would like to have a chance to see the following Perl introduction. Baidu Encyclopedia
First, basic types of Perl
The basic type of per is divided into two types: numeric type and string type.
Numeric types can
Perl Common function set 2
I. Process processing functions1. Process startup FunctionFunction Name evalCall the syntax eval_r (string)The description regards string as a Perl statement execution.After the command is correctly executed, the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.